<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/aa.js"></script>
<link rel="stylesheet" href="front/css/common.css" type="text/css" />

</head>
<body>

	<html:form action="managementUserAction" method="post">
	<html:hidden property="backUser.userid" styleClass="userclass" styleId="backUser.userid"/> 
		<input type="hidden" name="callMethod" id="callMethod" value="submitUser"/>
		<aa:zone name="areaZone">
			<div id="man_zone">

				<table width="99%" border="0" align="center" cellpadding="3"
					cellspacing="1" class="table_style">
					<tr>
						<td align="right" class="left_title_1" width="10%">姓名：</td>
						<td width="40%"><html:text property="backUser.username" maxlength="6" styleId="backUser.username"/>
						</td>
						<td align="right" class="left_title_1"  width="10%">帐号：</td>
						<td><html:text property="backUser.usernum" maxlength="15" styleId="backUser.usernum"/>
						</td>
					</tr>
					<tr>
						<td align="right">密码：</td>
						<td><html:password property="backUser.password" maxlength="16" styleId="backUser.password"/>
						</td>
						<td align="right">确认密码：</td>
						<td><html:password property="backUser.password1" maxlength="16" styleId="backUser.password1"/>
						</td>
					</tr>
					<tr>
						<td align="right" class="left_title_1">住址：</td>
						<td colspan="3"><html:text property="backUser.address" maxlength="30" styleId="backUser.address"
								style="width:41%;" />
						</td>
					</tr>
					<tr>
						<td align="right">角色：</td>
						<td><html:select property="backUser.roleid" styleId="backUser.roleid">
								<html:option value="-1">请选择角色</html:option>
								<html:options collection="roles" labelProperty="roleName"	property="roleID" />
							</html:select></td>
						<td align="right">联系电话：</td>
						<td><html:text property="backUser.phone" maxlength="12" styleId="backUser.phone"/>
						</td>
					</tr>
					
					<tr>
						<td colspan="4" style="text-align: center;"><input type="button" id="submitButton"
								onclick="submitUser();" value="提交" />
						</td>
					</tr>
				</table>

			</div>
		</aa:zone>
	</html:form>
</body>
<script>
function submitUser(){
	
	
	if($.trim($('#backUser\\.username').val())==''){
		alert('请输入姓名！');
		return ;
	}
	
	if($.trim($('#backUser\\.usernum').val())==''){
		alert('请输入帐号！');
		return ;
	}
	
	if($.trim($('#backUser\\.password').val())==''){
		alert('请输入密码！');
		return ;
	}
	if($.trim($('#backUser\\.password').val())!=$.trim($('#backUser\\.password1').val())){
		alert('密码输入不一致！');
		return ;
	}

	
	if($.trim($('#backUser\\.address').val())==''){
		alert('请输入住址！');
		return ;
	}
	
	if($.trim($('#backUser\\.roleid').val())=='-1'){
		alert('请选择角色！');
		return ;
	}
	
	if($.trim($('#backUser\\.phone').val())==''){
		alert('请输入联系方式！');
		return;
	}
	
	
	$('#submitButton').attr("disabled","disabled");
	$("input[name='backUser\\.areaList']").each(function() {  
        $(this).removeAttr("disabled");
    }); 
	
	
	$("form:first").submit(); 
}
	
	$(document).ready(function(){	
		 $("input[name='backUser\\.areaList']").each(function() {  
             $(this).attr("checked", true);  
         }); 
		<logic:notEmpty name="userError">
			alert('<%=request.getAttribute("userError")%>');
		</logic:notEmpty>
	});

	 
	ajaxAnywhere.showLoadingMessage = function() {
	}
	
	if($.trim($('#backUser\\.userid').val())!=''){
		$('#backUser\\.roleid').attr("disabled","disabled");
	}
</script>